<!--{template header}-->

<!--{if $_GET['op'] == 'edit'}-->

<script type="text/javascript">
	function passwordShow(value) {
		if(value==4) {
			$('span_password').style.display = '';
			$('tb_selectgroup').style.display = 'none';
		} else if(value==2) {
			$('span_password').style.display = 'none';
			$('tb_selectgroup').style.display = '';
		} else {
			$('span_password').style.display = 'none';
			$('tb_selectgroup').style.display = 'none';
		}
	}
	function getgroup(gid) {
		if(gid) {
			var x = new Ajax();
			x.get('cp.php?ac=privacy&op=getgroup&gid='+gid, function(s){
				$('target_names').innerHTML += s;
			});
		}
	}
</script>

<div class="c_header">
	<ul class="tabs">
		<li class="active"><a href="cp.php?ac=album&op=edit&albumid=$albumid">编辑相册信息</a></li>
		<li><a href="cp.php?ac=album&op=editpic&albumid=$albumid">编辑图片</a></li>
		<li><a href="cp.php?ac=upload&albumid=$albumid">上传新图片</a></li>
	</ul>
</div>

<div class="h_status">$album[albumname]<span class="pipe">|</span><a href="space.php?do=album&id=$albumid">返回相册</a></div>

<div class="d_content">
<form method="post" id="theform" name="theform" action="cp.php?ac=album&op=edit&albumid=$albumid" class="c_form">
<table cellspacing="0" cellpadding="0" class="formtable">
	<tr>
		<th width="80"><label for="albumname">相册名</label></th>
		<td><input type="text" id="albumname" name="albumname" value="$album[albumname]" size="20" class="t_input" /></td>
	</tr>
	<tr>
		<th>隐私设置</th>
		<td>
			<select name="friend" onchange="passwordShow(this.value);">
				<option value="0"$friendarr[0]>全站用户可见</option>
				<option value="1"$friendarr[1]>全好友可见</option>
				<option value="2"$friendarr[2]>仅指定的好友可见</option>
				<option value="3"$friendarr[3]>仅自己可见</option>
				<option value="4"$friendarr[4]>凭密码查看</option>
			</select>
			<span id="span_password" style="$passwordstyle">密码:<input type="text" name="password" value="$album[password]" size="10"></span>
		</td>
	</tr>
	<tbody id="tb_selectgroup" style="$selectgroupstyle">
	<tr>
		<th>指定好友</th>
		<td><select name="selectgroup" onchange="getgroup(this.value);">
			<option value="">从好友组选择好友</option>
			<!--{loop $groups $key $value}-->
			<option value="$key">$value</option>
			<!--{/loop}-->
			</select> 多次选择会累加到下面的好友名单</td>
	</tr>
	<tr>
		<th>&nbsp;</th>
		<td>
		<textarea name="target_names" id="target_names" style="width:85%;" rows="3">$album[target_names]</textarea>
		<br>(可以填写多个好友名，请用空格进行分割)</td>
	</tr>
	</tbody>
	<tr>
		<th>&nbsp;</th>
		<td>
		<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
		<input type="hidden" name="editsubmit" value="true" />
		<button name="submit" type="submit" class="submit" value="true">确定</button>&nbsp;
		</td>
	</tr>
	<tr>
		<th>&nbsp;</th>
		<td><a href="cp.php?ac=album&op=delete&albumid=$album[albumid]" id="album_delete_$album[albumid]" onclick="ajaxmenu(event, this.id, 99999)">删除相册</a></td>
	</tr>

</table>
</form>
</div>

<!--{elseif $_GET['op'] == 'editpic'}-->

<div class="c_header">
	<ul class="tabs">
		<!--{if $album[albumname]}--><li><a href="cp.php?ac=album&op=edit&albumid=$albumid">编辑相册信息</a></li><!--{/if}-->
		<li class="active"><a href="cp.php?ac=album&op=editpic&albumid=$albumid">编辑图片</a></li>
		<li><a href="cp.php?ac=upload&albumid=$albumid">上传新图片</a></li>
	</ul>
</div>

<div class="h_status">
<!--{if $album[albumname]}-->
$album[albumname]<span class="pipe">|</span><a href="space.php?do=album&id=$albumid">返回相册</a>
<!--{else}-->
<a href="space.php?do=album&id=-1">返回默认相册</a>
<!--{/if}-->
</div>

<div class="d_content">
	<div class="albums_list">
		<form method="post" id="theform" name="theform" action="cp.php?ac=album&op=editpic&albumid=$albumid">
		<!--{if $list}-->
		<table cellspacing="6" cellpadding="0" width="100%">
			<!--{loop $list $value}-->
			<tr>
				<td align="center"><a href="$value[bigpic]" target="_blank"><img src="$value[pic]" width="100"></a>
				<!--{if $album[albumname]}--><br />[ <a href="cp.php?ac=album&op=setpic&picid=$value[picid]" id="a_picid_$value[picid]" onclick="ajaxmenu(event, this.id, 2000)">设为封面</a> ]<!--{/if}-->
				</td>
				<td>
				图片描述:<br /><textarea name="title[{$value[picid]}]" rows="5" cols="50">$value[title]</textarea>
				<br /><input type="checkbox" name="ids[{$value[picid]}]" value="{$value[picid]}"> 选择图片</td>
			</tr>
			<!--{/loop}-->
			<tr>
				<td colspan="2">
					<input type="checkbox" id="chkall" name="chkall" onclick="checkAll(this.form, 'ids')"> 全选
					<input type="submit" name="editpicsubmit" value="更新" class="submit" onclick="this.form.action+='&subop=update';">
					<input type="submit" name="editpicsubmit" value="删除" class="submit" onclick="this.form.action+='&subop=delete';return ischeck('theform', 'ids')">
					<input type="submit" name="editpicsubmit" value="转移到:" class="submit" onclick="this.form.action+='&subop=move';return ischeck('theform', 'ids')">
					<select name="newalbumid">
					<!--{loop $albumlist $key $value}-->
					<!--{if $albumid != $value[albumid]}--><option value="$value[albumid]">$value[albumname]</option><!--{/if}-->
					<!--{/loop}-->
					<!--{if $albumid>0}--><option value="0">默认相册</option><!--{/if}-->
					</select>
				</td>
			</tr>
		</table>
		<!--{else}-->
		<div class="article l_text">该相册下还没有图片，你可以<a href="cp.php?ac=upload&albumid=$albumid">上传新图片</a></div>
		<!--{/if}-->
		<input type="hidden" name="start" value="$start" />
		<input type="hidden" name="editpicsubmit" value="true" />
		</form>
	</div>
	<div class="page">$multi[html]</div>
</div>

<!--{elseif $_GET['op'] == 'delete'}-->

<div <!--{if !$_SGLOBAL[inajax]}-->class="inpage"<!--{/if}-->>
<form method="post" id="theform" name="theform" action="cp.php?ac=album&op=delete&albumid=$albumid">
	<h1>确定删除相册吗？</h1>
	<p class="btn_line">
		相册中的图片: 
		<select name="moveto">
			<option value="-1">彻底删除</option>
			<option value="0">转移到 默认相册</option>
			<!--{loop $albums $value}-->
			<option value="$value[albumid]">转移到 $value[albumname]</option>
			<!--{/loop}-->
		</select>
		<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
		<input type="hidden" name="deletesubmit" value="true" />
		<button name="submit" type="submit" class="submit" value="true">确定</button>&nbsp;
		<!--{if $_SGLOBAL[inajax]}--><button name="cancel" type="button" class="button" onclick="hideMenu()">取消</button><!--{/if}-->
	</p>
</form>
</div>

<!--{/if}-->
<!--{template footer}-->